package com.ityunhe.dao.impl;

import java.util.List;

import org.apache.ibatis.session.SqlSession;

import com.ityunhe.bean.Comment;
import com.ityunhe.dao.CommentDao;
import com.ityunhe.factory.MybatisUtil;

public class CommentDaoImpl implements CommentDao {

	@Override
	public int saveComment(Comment comment) {
		int saveComment=0;
		try {
			SqlSession session = MybatisUtil.getSession();
			CommentDao mapper = session.getMapper(CommentDao.class);
			saveComment = mapper.saveComment(comment);
			session.commit();
		} catch (Exception e) {
			throw new RuntimeException("添加评论异常");
		}finally{
			MybatisUtil.closeSession();
		}
		return saveComment;
	}
	@Override
	public int remove(Comment comment) {
		// TODO Auto-generated method stub
		return 0;
	}

	@Override
	public int update(Comment comment) {
		// TODO Auto-generated method stub
		return 0;
	}

	@Override
	public Comment getComment(Comment comment) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public List<Comment> listComment() {
		// TODO Auto-generated method stub
		return null;
	}

}
